#region [file: TituloFinanceiroDAL.cs, author: Lucas Bittencourt]
// File:    TituloFinanceiroDAL.cs
// Author:  Lucas Bittencourt
// Created: quarta-feira, 23 de novembro de 2011 23:59:32
// Purpose: Defines dao implementation class for class TituloFinanceiro
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using NHibernate.Criterion;
using DA_OOMModel;
using DA_OOMModelIDAL;

namespace DA_OOMNHibernateDAL
{
   /// <summary>
   /// Class that implements methods of ITituloFinanceiroDAL interface
   /// </summary>
   public partial class TituloFinanceiroDAL : NHibernateDALBase,  ITituloFinanceiroDAL 
   {
      #region CRUD methods
      /// <summary>
      /// Get all instances of TituloFinanceiro
      /// </summary>     
      public List<TituloFinanceiro> GetTituloFinanceiroList()
      {
         return ConvertToGenericList(base.LoadAll(typeof(TituloFinanceiro)));
      }
      
      /// <summary>
      /// Get the instances of TituloFinanceiro from index firstResult to index maxResult
      /// </summary>
      public List<TituloFinanceiro> GetTituloFinanceiroList(int firstResult, int maxResult)
      {
         return ConvertToGenericList(base.LoadAll(typeof(TituloFinanceiro), firstResult, maxResult));
      }

      /// <summary>
      /// Load the instance of TituloFinanceiro according its primary key instance.
      /// </summary>
      public TituloFinanceiro Load(TituloFinanceiroPK tituloFinanceiroPK)
      {
         IList cs = new ArrayList();
         string[] paramNames = new string[] { "TtfIdTitulo" };
         object[] values = new object[] { tituloFinanceiroPK.TtfIdTitulo };
         for (int i = 0; i < paramNames.Length; i++)
             cs.Add(Expression.Eq(paramNames[i], values[i]));

         IList list = base.FindByCriterions(typeof(TituloFinanceiro), cs);
         return (((list != null) && (list.Count > 0)) ? (TituloFinanceiro)list[0] : null);
      }

      /// <summary>
      /// Query the instances of TituloFinanceiro according its example instance.
      /// </summary>
      public List<TituloFinanceiro> QueryByExample(TituloFinanceiro tituloFinanceiro)
      {
         return ConvertToGenericList(base.QueryByExample(typeof(TituloFinanceiro), tituloFinanceiro));
      }

      /// <summary>
      /// Query the instances of TituloFinanceiro according its example instance from index firstResult to index maxResult
      /// </summary>
      public List<TituloFinanceiro> QueryByExample(TituloFinanceiro tituloFinanceiro, int firstResult, int maxResult)
      {
         return ConvertToGenericList(base.QueryByExample(typeof(TituloFinanceiro), tituloFinanceiro, firstResult, maxResult));
      }
      
      /// <summary>
      /// Insert the instances of TituloFinanceiro
      /// </summary>
      public void Insert(TituloFinanceiro tituloFinanceiroObject)
      {
         base.Save(tituloFinanceiroObject);
      }
      
      /// <summary>
      /// Update the instances of TituloFinanceiro
      /// </summary>
      public void Update(TituloFinanceiro tituloFinanceiroObject)
      {
         base.Update(tituloFinanceiroObject);
      }
      
      /// <summary>
      /// Delete the instances of TituloFinanceiro
      /// </summary>
      public void Delete(TituloFinanceiro tituloFinanceiroObject)
      {
         base.Delete(tituloFinanceiroObject);
      }
      #endregion
      
   
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfVlTitulo
      /// </summary>
      public List<TituloFinanceiro> FindByTtfVlTitulo(decimal ttfVlTitulo) 
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfVlTitulo", ttfVlTitulo));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs));
      }
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfVlTitulo, 
      /// and the result is from index firstResult to  index maxResult
      /// </summary>
      public List<TituloFinanceiro> FindByTtfVlTitulo(decimal ttfVlTitulo, int firstResult, int maxResult)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfVlTitulo", ttfVlTitulo));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs, firstResult, maxResult));
      }
      
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfNuNossoNumero
      /// </summary>
      public List<TituloFinanceiro> FindByTtfNuNossoNumero(string ttfNuNossoNumero) 
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfNuNossoNumero", ttfNuNossoNumero));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs));
      }
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfNuNossoNumero, 
      /// and the result is from index firstResult to  index maxResult
      /// </summary>
      public List<TituloFinanceiro> FindByTtfNuNossoNumero(string ttfNuNossoNumero, int firstResult, int maxResult)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfNuNossoNumero", ttfNuNossoNumero));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs, firstResult, maxResult));
      }


      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfNuNossoNumero
      /// </summary>
      public List<TituloFinanceiro> FindByTtfNuTitulo(int ttfNuTitulo)
      {
          IList cs = new ArrayList();
          cs.Add(Expression.Eq("TtfNuTitulo", ttfNuTitulo));
          return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs));
      }

      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfNuNossoNumero, 
      /// and the result is from index firstResult to  index maxResult
      /// </summary>
      public List<TituloFinanceiro> FindByTtfNuTitulo(int ttfNuTitulo, int firstResult, int maxResult)
      {
          IList cs = new ArrayList();
          cs.Add(Expression.Eq("TtfNuTitulo", ttfNuTitulo));
          return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs, firstResult, maxResult));
      }
      
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfDtEmissaoBoleto
      /// </summary>
      public List<TituloFinanceiro> FindByTtfDtEmissaoBoleto(DateTime ttfDtEmissaoBoleto) 
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfDtEmissaoBoleto", ttfDtEmissaoBoleto));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs));
      }
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfDtEmissaoBoleto, 
      /// and the result is from index firstResult to  index maxResult
      /// </summary>
      public List<TituloFinanceiro> FindByTtfDtEmissaoBoleto(DateTime ttfDtEmissaoBoleto, int firstResult, int maxResult)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfDtEmissaoBoleto", ttfDtEmissaoBoleto));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs, firstResult, maxResult));
      }
      
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfDtVencimento
      /// </summary>
      public List<TituloFinanceiro> FindByTtfDtVencimento(DateTime ttfDtVencimento) 
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfDtVencimento", ttfDtVencimento));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs));
      }
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfDtVencimento, 
      /// and the result is from index firstResult to  index maxResult
      /// </summary>
      public List<TituloFinanceiro> FindByTtfDtVencimento(DateTime ttfDtVencimento, int firstResult, int maxResult)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfDtVencimento", ttfDtVencimento));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs, firstResult, maxResult));
      }
      
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfDtCadastro
      /// </summary>
      public List<TituloFinanceiro> FindByTtfDtCadastro(DateTime ttfDtCadastro) 
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfDtCadastro", ttfDtCadastro));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs));
      }
      
      /// <summary>
      /// Find the instances of TituloFinanceiro according to its attribute ttfDtCadastro, 
      /// and the result is from index firstResult to  index maxResult
      /// </summary>
      public List<TituloFinanceiro> FindByTtfDtCadastro(DateTime ttfDtCadastro, int firstResult, int maxResult)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("TtfDtCadastro", ttfDtCadastro));
         return ConvertToGenericList(base.FindByCriterions(typeof(TituloFinanceiro), cs, firstResult, maxResult));
      }

      /// <summary>
      /// Convert the IList to the generic List instance.
      /// </summary>
      private List<TituloFinanceiro> ConvertToGenericList(IList tituloFinanceiros)
      {
         List<TituloFinanceiro> tituloFinanceiroList = new List<TituloFinanceiro>();
         foreach (TituloFinanceiro tituloFinanceiro in tituloFinanceiros)
         {
             tituloFinanceiroList.Add(tituloFinanceiro);
         }
         return tituloFinanceiroList;
      }      
   }
}